﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Mvc;

namespace _2301MVCDemo.Controllers
{
    public class RegisterController : Controller
    {
        // GET: Register
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Register(string name,string pwd1,string pwd2)
        {

            return View("Index");
        }

        public ActionResult Check(string LoginID)
        {
            if (LoginID != null)
            {
                if (LoginID == "abc111")
                {
                    ViewBag.tip = "该登录号已存在";
                }
                else
                {
                    ViewBag.tip = "该登录号可用";
                }
            }
            ViewBag.datetime = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss");
            return View("AddCustomer");
        }

        public ActionResult AjaxCheck(string LoginID)
        {
            //Thread.Sleep(10000);//睡眠10秒（相当于暂停10秒）
            if (LoginID != null)
            {
                if (LoginID == "abc111")
                {
                    return Content("该登录号已存在");
                }
                else
                {
                    return Content("该登录号可用");
                }
            }
            return Content("登录号为空！");
        }
    }
}